package com.tangyuan.oss.ossMinio.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: TangYuan
 * @Date: 2024/6/3 13:45
 * @描述: minio配置
 */
@Configuration
public class MinioConfig {
    
    /** url */
    @Value("${storage.service.minio.url}")
    private String url;
    
    /** accessKey */
    @Value("${storage.service.minio.accessKey}")
    private String accessKey;
    
    /** secretKey */
    @Value("${storage.service.minio.secretKey}")
    private String secretKey;
    
    /**
     * 构建 MinioClient
     * @return {@link MinioClient}
     * @Date: 2024/6/3 下午1:50
     */
    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
    }
    
}
